#include "ejbase.h"
#include <QSplitter>
#include <QTextEdit>
#include <QTextCodec>

#include <QPushButton>
#include <QListWidget>

#include <QFile>

#include "ejstylesheet.h"
#include "ejattrset.h"
#include "ejcareerset.h"
#include "ejskillset.h"
#include "ejitemset.h"

EjBase::EjBase(QWidget *parent) : QMainWindow(parent)
{
    //设置主窗口背景色
    setStyleSheet("QWidget { background-color: #323232; }");
    //分割窗口
    auto mainSplitter = new QSplitter(Qt::Horizontal, this);
    mainSplitter->setHandleWidth(1);
    mainSplitter->setStyleSheet("QSplitter::handle { background-color: #666666 }");
    auto tab = new QTabWidget(mainSplitter);
    tab->addTab(new EJCareerSet, tr("门派设定"));
    tab->addTab(new EJAttrSet, tr("属性设定"));
    tab->addTab(new EJSkillSet, tr("技能设定"));
    tab->addTab(new EJItemSet, tr("道具设定"));
    tab->addTab(new QTextEdit, tr("任务设定"));
    tab->addTab(new QTextEdit, tr("玩家属性"));
    tab->addTab(new QTextEdit, tr("宠物属性"));
    tab->addTab(new QTextEdit, tr("怪物属性"));

    QFile baseFile("./theme/BaseTabWidget.qss");
    if (baseFile.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        g_tabBarStyle = baseFile.readAll();
    }
    tab->setStyleSheet(g_tabBarStyle);

    setCentralWidget(mainSplitter);
}
